package com.ice.demo.java8;

import java.util.function.Supplier;
import java.util.stream.Stream;

public class CreateStream {

    public static void main(String[] args) {

        Stream<NatualSupplier> natual1 = Stream.generate(NatualSupplier::new);

        Stream<Integer> natual2 = Stream.generate(new NatualSupplier());


    }


}

class NatualSupplier implements Supplier<Integer> {

    int n = 0;

    @Override
    public Integer get() {
        n++;
        return n;
    }

}